home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / lib / mathlib / libblas / src_original / csrot.f < prev    next >
Encoding:
Text File  |  1994-08-02  |  1.2 KB  |  52 lines

  1.       SUBROUTINE CSROT( N, CX, INCX, CY, INCY, C, S )
  2. *
  3. *     applies a plane rotation, where the cos and sin (c and s) are real
  4. *     and the vectors cx and cy are complex.
  5. *     jack dongarra, linpack, 3/11/78.
  6. *
  7. *     .. Scalar Arguments ..
  8.       INTEGER           INCX, INCY, N
  9.       REAL              C, S
  10. *     ..
  11. *     .. Array Arguments ..
  12.       COMPLEX           CX( 1 ), CY( 1 )
  13. *     ..
  14. *     .. Local Scalars ..
  15.       INTEGER           I, IX, IY
  16.       COMPLEX           CTEMP
  17. *     ..
  18. *     .. Executable Statements ..
  19. *
  20.       IF( N.LE.0 )
  21.      $   RETURN
  22.       IF( INCX.EQ.1 .AND. INCY.EQ.1 )
  23.      $   GO TO 20
  24. *
  25. *        code for unequal increments or equal increments not equal
  26. *          to 1
  27. *
  28.       IX = 1
  29.       IY = 1
  30.       IF( INCX.LT.0 )
  31.      $   IX = ( -N+1 )*INCX + 1
  32.       IF( INCY.LT.0 )
  33.      $   IY = ( -N+1 )*INCY + 1
  34.       DO 10 I = 1, N
  35.          CTEMP = C*CX( IX ) + S*CY( IY )
  36.          CY( IY ) = C*CY( IY ) - S*CX( IX )
  37.          CX( IX ) = CTEMP
  38.          IX = IX + INCX
  39.          IY = IY + INCY
  40.    10 CONTINUE
  41.       RETURN
  42. *
  43. *        code for both increments equal to 1
  44. *
  45.    20 DO 30 I = 1, N
  46.          CTEMP = C*CX( I ) + S*CY( I )
  47.          CY( I ) = C*CY( I ) - S*CX( I )
  48.          CX( I ) = CTEMP
  49.    30 CONTINUE
  50.       RETURN
  51.       END
  52.